﻿<dialogs:DialogWindow x:Class="Modules.Login.Views.UserRegistrationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:commands="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
             xmlns:controls="clr-namespace:Common.Controls.Controls;assembly=Common.Controls"
             xmlns:dialogs="clr-namespace:Common.Dialogs;assembly=Common.Dialogs"
             mc:Ignorable="d" 
             x:Name="dialogWindow"
             WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize"
             Background="Transparent" WindowStartupLocation="CenterScreen"
             WindowResult="{Binding DialogResult}"
             Width="360" Height="246"
             >
    <dialogs:DialogWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Common.Dialogs;component/Styles/CommonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </dialogs:DialogWindow.Resources>
    <Grid x:Name="LayoutRoot"
          controls:BusyIndicatorBehavior.AddMargins="True" 
          controls:BusyIndicatorBehavior.BusyState="{Binding IsBusy}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border x:Name="HeaderBorder" Grid.Row="0" BorderThickness="2,2,2,0" CornerRadius="10,10,0,0" BorderBrush="Black" Background="SteelBlue"
                MouseDown="HeaderBorder_MouseDown"
                >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <StackPanel HorizontalAlignment="Left" Grid.Column="0">
                    <TextBlock Text="User registration" Style="{StaticResource DialogHeaderTextStyle}"/>
                </StackPanel>
                <StackPanel HorizontalAlignment="Right" Grid.Column="1">
                    <Button VerticalAlignment="Center" Margin="8" Style="{StaticResource CloseButtonStyle}" IsCancel="True"
                            commands:Click.Command="{Binding CancelCommand}">
                        <Button.Content>
                            <Image Source="/Common.Dialogs;component/Images/305_Close_16x16_72.png" Width="12" Height="12"/>
                        </Button.Content>
                    </Button>
                </StackPanel>
            </Grid>
        </Border>
        <Border Grid.Row="1" BorderThickness="2,0,2,2" CornerRadius="0,0,4,4" BorderBrush="Black" Background="LightGray">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBox Grid.Row="0" Style="{StaticResource NotificationTextBoxStyle}" Margin="8" IsReadOnly="True"
                        VerticalContentAlignment="Center"  AcceptsReturn="True" TextWrapping="Wrap"
                        Text="In order to store user specific settings for this application user information should be provided:" />
                    <Grid Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="User name:" Grid.Row="0" Grid.Column="0" Margin="8" FontWeight="Bold" VerticalAlignment="Center"/>
                        <TextBlock Text="Password:" Grid.Row="1" Grid.Column="0" Margin="8" FontWeight="Bold" VerticalAlignment="Center"/>

                        <TextBox Text="{Binding UserName,ValidatesOnExceptions=True}" Grid.Row="0" Grid.Column="1" Margin="8,4,8,4" VerticalAlignment="Center"/>
                        <TextBox Text="{Binding Password,ValidatesOnExceptions=True}"  Grid.Row="1" Grid.Column="1" Margin="8,4,8,4" VerticalAlignment="Center"/>

                    </Grid>
                </Grid>
                <StackPanel Grid.Row="1" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal">
                    <Button x:Name="OkButton" Content="Ok" Width="75" Margin="6"
                            Style="{StaticResource DialogButtonStyle}" IsDefault="True"
                            commands:Click.Command="{Binding RegisterNewUserCommand}"
                            commands:Click.CommandParameter="{Binding ElementName=dialogWindow}"
                            />
                    <Button x:Name="CancelButton" Content="Cancel" Width="75" IsCancel="True" Margin="6"
                            Style="{StaticResource DialogButtonStyle}"
                            commands:Click.Command="{Binding CancelCommand}"
                            />
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</dialogs:DialogWindow>
